package com.wzy.wzyblog.service;

import com.wzy.wzyblog.dao.UserRepository;
import com.wzy.wzyblog.po.User;
import com.wzy.wzyblog.util.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService{

//    注入数据库
    @Autowired
    private UserRepository userRepository;

//前段登陆校验用户名密码方法
    @Override
    public User checkUser(String username, String password) {
//        调用dao层                                                         加密密码
        User user = userRepository.findByUsernameAndPassword(username, MD5Utils.code(password) );
        return user;
    }
}
